package test;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: user
 * Date: 2024-03-13
 * Time: 14:02
 */
public class c {
//    public static void main(String[] args) {
//// 数字转字符串
//        String s1 = String.valueOf(1234);
//        String s2 = String.valueOf(12.34);
//        String s3 = String.valueOf(true);
//        System.out.println(s1);
//        System.out.println(s2);
//        System.out.println(s3);
//        System.out.println("=================================");
//// 字符串转数字
//// 注意：Integer、Double等是Java中的包装类型，这个后面会讲到
//        int data1 = Integer.parseInt("1234");
//        double data2 = Double.parseDouble("12.34");
//        System.out.println(data1);
//        System.out.println(data2);
//    }
//public static void main(String[] args) {
//    String s = "hello";
//// 字符串转数组
//    char[] ch = s.toCharArray();
//    for (int i = 0; i < ch.length; i++) {
//        System.out.print(ch[i]);
//    }
//    System.out.println();
//// 数组转字符串
//    String s2 = new String(ch);
//    System.out.println(s2);
//}
public static void main(String[] args) {
 String s1 = "Hello, my name is John";
 int count = 0;
String[] sb = s1.split(" ");
    for (String ch: sb ) {
       count++;
    }
    System.out.println(count);
}
}
